﻿using FluentValidation;
using Jupiter.Infrastructure.Domain;
using MediatR;

namespace Wips.AppService.Publisher.Requests
{
    /// <summary>
    /// 更新子服务相关配置
    /// </summary>
    public class UpdateAgentServerRequest : IRequest<string>, ITxRequest
    {
        /// <summary>
        /// 需要更新的数据id
        /// </summary>
        public string Id { get; set; } = "";

        /// <summary>
        /// 访问地址
        /// </summary>
        public string AgentAddress { get; set; } = "";



    }


    /// <summary>
    /// 校验
    /// </summary>
    public class UpdateAgentServerRequestValidator : AbstractValidator<UpdateAgentServerRequest>
    {
        /// <summary>
        /// 
        /// </summary>
        public UpdateAgentServerRequestValidator()
        {
            RuleFor(p => p.Id)
                .Must(p => !string.IsNullOrEmpty(p))
                .WithMessage("Id不能为空");

            RuleFor(p => p.AgentAddress)
                .Must(p => !string.IsNullOrEmpty(p))
                .WithMessage("PublicAddress不能为空");

        }
    }
}
